//移除链表元素
/*class ListNode {
     int val;
     ListNode next;
     ListNode() {}
    ListNode(int val) { this.val = val; }
     ListNode(int val, ListNode next) { this.val = val; this.next = next; }
  }

class Solution {
 public ListNode removeElements(ListNode head, int val) {
     if (head == null) {
         return null;
     }
     ListNode slow = head;
     ListNode flat = head.next;
     while (flat == null) {
         if (flat.val == val) {
             slow.next = flat.next;
             flat = flat.next;
         }
         slow = flat;
         flat = flat.next;
     }
     if (head.val == val) {
         head = head.next;
     }
     return slow;
 }
}*/

public  class  Test{


 }

//链表的中间结点
 /*  class ListNode {
      int val;
      ListNode next;
     ListNode() {}
      ListNode(int val) { this.val = val; }
      ListNode(int val, ListNode next) { this.val = val; this.next = next; }
  }
class Solution {
 public ListNode middleNode(ListNode head) {
     int co = 0;
     ListNode cur = head;
  while (head != null){
    co++;
    head = head.next;
  }
  for (int i = 0; i < co/2; i++) {
   cur = cur.next;
  }
  return cur;
 }
}
class Solution {
 public ListNode middleNode(ListNode head) {
  ListNode fast = head;
  ListNode slow = head;
  while(fast!=null && fast.next!=null){
   slow = slow.next;
   fast = fast.next.next;

  }
  return slow;
 }
}*/
//合并两个有序链表
/*class Solution {
 public ListNode mergeTwoLists(ListNode list1, ListNode list2) {
  ListNode newH = new ListNode(-1);
  ListNode tmpH = newH;

  while (list1 != null && list2 != null){
   if (list1.val < list2.val){
    tmpH.next = list1;
    list1 = list1.next;
   }else{
    tmpH.next = list2;
    list2 = list2.next;
   }
   tmpH = tmpH.next;
  }
  if (list1 != null){
   tmpH.next = list1;
  }
  if (list2 != null){
   tmpH.next = list2;
  }
  return newH.next;

 }
}*/
//判定回文
/*
public class PalindromeList {
 public boolean chkPalindrome(ListNode A) {
  if(A == null || A.next==null){
   return true;
  }
  ListNode fast = A;
  ListNode slow = A;

  while(fast!=null &&fast.next !=null  ){
   fast = fast.next.next;
   slow = slow.next;
  }
  ListNode cur = slow.next;
  while(cur != null){
   ListNode curNext = cur.next;
   cur.next = slow;
   slow = cur;
   cur = curNext;
  }
  while(A != slow){
   if(A.val != slow.val){
    return false;
   }
   if(A.next == slow){
    return true;
   }
   A = A.next;
   slow = slow.next;
  }
  return true;
 }
}*/
